<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    if (0) { console.log(222222); }
    function fn(age) {
        // console.log(age);
        // var age = age || 20
        // 除了null和undefined其他传过来的都直接执行 
        var age = age ?? 20
        console.log(age);
    }
    // fn(10)
    // fn() // 20
    fn(false) // 20  f
    fn(null) //  20  /20
    fn(true) // true  /true
    fn(undefined) // 20  /20
    fn(0) // 20 /0
    fn(1) // 1 /1

    function fn1(name) {
        var name = 'zs'
        // let name = 'ls'
        console.log(name);
    }
    fn1('zs')

    function fn2(age) {
        var age = 10
        age = 20

    }
    fn2(10)
    console.log(age);
</script>

</html>